<template>
	<view>
		<uni-nav-bar class="custom-nav-bar" fixed status-bar title="融创服务｜聚友趣">
			<view slot="left" class="common left">
				<view class="location" @click.stop="lookMessage">
					<image
						src="https://mall-rongchuang.oss-cn-beijing.aliyuncs.com/association/store/2020/10/22/personMessage.png"
						style="width: 40rpx;height: 40rpx;"
					></image>
					<text v-if="num">{{num}}</text>
				</view>
			</view>
		</uni-nav-bar>
		<personal ref="personal"></personal>
	</view>
</template>

<script>
import { getCommonShareInfo } from '@/common/utils.js';
import http from '@/common/request.js';
import Personal from './personal.vue';
export default {
	components: { Personal },
	onShareAppMessage() {
		return getCommonShareInfo();
	},
	data() {
		return {
			num: ''
		};
	},
	onShow() {
		this.$nextTick(() => {
			this.$refs.personal.getImage();
			this.$refs.personal.modelList();
		});
		this.message()
	},
	methods: {
		message() {
			http('/api/cusMessageNotice/getUnreadCount', { method: 'GET', data: { } }).then(result => {
				if (result.code == '200') {
					this.num = result.unReadCount
				}
			});
		},
		lookMessage() {
			//埋点
			this.$umaTrackEvent('enterMessageCenter', { source: '个人中心页' });
			uni.navigateTo({
				url: '/personal/message',
				animationType: 'pop-in',
				animationDuration: 200
			});
		}
	},
	onPullDownRefresh() {
		this.$refs.personal.getImage();
		this.$refs.personal.modelList();
		setTimeout(function() {
			uni.stopPullDownRefresh();
		}, 1000);
	},
};
</script>
<style lang="less" scoped>
/deep/.uni-nav-bar-text {
	color: #333 !important;
	font-size: 26rpx !important;
	padding: 6rpx 10rpx 0 0 !important;
}
.location {
	height: 50rpx;
	border-radius: 25rpx;
	line-height: 1;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 18rpx;
	font-size: 24rpx;
	color: #66645d;
	.city-name {
		margin-right: 6rpx;
		white-space: nowrap;
		text-overflow: ellipsis;
		// width: 120rpx;
	}
	text {
		background: #F39800;
		text-align: center;
		border-radius: 100%;
		color: #fff;
		font-size: 16rpx;
		// padding: 2rpx 4rpx;
		position: absolute;
		left: 66rpx;
		bottom: 40rpx;
		min-width: 24rpx;
		height: 24rpx;
		line-height: 26rpx;
	}
}
.house-select {
	position: fixed;
	/* #ifdef MP-WEIXIN */
	top: 64px;
	/* #endif */
	/* #ifndef MP-WEIXIN */
	top: 44px;
	/* #endif */
	left: 14px;
	z-index: 100;
	background: #fff;
	width: 100px;
	border-radius: 0px 0px 12px 12px;
}
</style>
